package com.nercel.dsj.gksales.api.controller;

import com.nercel.dsj.gksales.util.SafeBase64;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author sunlin
 * @date 2019-4-23
 */
@RestController
@Api(tags = "工具类接口")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UtilApiController {

	@PostMapping(value = "/api/v1/utils/safe-base64/encode")
    @ApiOperation(value = "SAFE-BASE64-ENCODE")
    public Object safeBase64Encode(@ApiParam(value = "编码内容") @RequestParam String string) {
		return SafeBase64.safeUrlBase64Encode(string);
    }

	@PostMapping(value = "/api/v1/utils/safe-base64/decode")
	@ApiOperation(value = "SAFE-BASE64-ENCODE")
	public Object safeBase64Decode(@ApiParam(value = "编码内容") @RequestParam String string) {
		return SafeBase64.safeUrlBase64Decode(string);
	}

}
